﻿Imports Training.Common

Partial Public Class RetakeQuiz
    Inherits System.Web.UI.Page

    ''' <summary>
    ''' Page load event, check for querystring data
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>Delete QuizData for user, then redirect to quiz so they can try again</remarks>
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Request.QueryString("qid")) And Not IsNothing(Request.QueryString("qnm")) Then
            Dim qid As Integer
            Dim qnm As String

            qid = Request.QueryString("qid")
            qnm = Request.QueryString("qnm")
            ' delete user quiz info
            DeleteUserQuizData(Session("uid"), qid)
            ' redirect to quiz
            Response.Redirect("Quiz.aspx?qid=" & qid & "&qnm=" & qnm)
        Else
            Response.Redirect("error.htm")
        End If
    End Sub

End Class